package com.hnx.admin.security.utils;

import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContextHolder;

/*
项目名称： core
创 建 人: 倔强的头发
创建日期： 2025/5/31   18:38:09 
描   述：
*/
public class SecurityUtil {
    public static Authentication getAuthentication() {
        return SecurityContextHolder.getContext().getAuthentication();
    }
    public static Object getPrincipal() {
        Authentication authentication = getAuthentication();
        if (authentication != null) {
            return authentication.getPrincipal();
        }
        return null;
    }
}
